package com.wn.demo01;

import cn.hutool.crypto.digest.BCrypt;

/**
 * @author yellow Docter
 * @date 2022 -11-08
 * @desc
 */
public class Demo03 {

    public static void main(String[] args) {

        ///hu.tool有加密工具

        // 获取盐值
        String gensalt = BCrypt.gensalt();
        System.out.println("gensalt = " + gensalt);

        //通过盐值加密
        String hashpw = BCrypt.hashpw("123", gensalt);
        //加密后的密码
        System.out.println("hashpw = " + hashpw);
        
        //校验
        boolean checkpw = BCrypt.checkpw("123", hashpw);
        System.out.println("checkpw = " + checkpw);
        
        

    }
}
